import Vue from 'vue'
import { $POST, $DELETE, $PUT, $GET, $UploadFile } from '__UTILS__/http_request/request-method.js'
import VueConfig, {preffix} from '__CONFIG__/vue-config.js'
const disposeResFunName = VueConfig[preffix + 'REQUEST_DISPOSE'].name //获取到处理返回结果函数名
const disposeResFun = Vue.prototype[disposeResFunName] // 获取到了处理函数

//是否收藏
export function isCollected(article_id, user_id) {
  const API = 'collections/' + user_id + '/' + article_id 
  return $GET(API, disposeResFun)
}

//收藏操作
export function collectArticle({
  article_id, user_id, access_token, collectionType
}) {
  const API = 'collections'
  return $POST(API, {article_id, user_id, access_token, collectionType}, disposeResFun)
}